{extend name="$_tpl_public_layout_danceadmin"/}


{block name="breadcrumb"}
<ol class="breadcrumb">
	<li class="breadcrumb-item"><a href="{:url('admin/index/index')}">{:config('system.site_title')}</a></li>
	<li class="breadcrumb-item"><a href="{:url('mobmall_manage/user/index')}">{$sideName}</a></li>
</ol>
{/block}


{block name="pageheader"}
{$sideName}
{/block}


{block name="content"}
<!-- 搜索框 -->
<div class="card mb-3">
	<div class="card-body">
		<form method="get" action="" class="J_ajaxForm">
			<div class="form-row mb-1">
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">用户uid</div>
						</div>
						<input type="text" name="id" value="{$id}" class="form-control" />
					</div>
				</div>
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">用户名</div>
						</div>
						<input type="text" name="username" value="{$username}" class="form-control" />
					</div>
				</div>
				<div class="col-md-3 help-block-txt">
					<?php
					${'gender_'.$gender} = 'checked';
					?>
					<label>性别：</label>
					<label><input type="radio" name="gender" value="1" {$gender_1} /> 男</label>
					<label><input type="radio" name="gender" value="2" {$gender_2} /> 女</label>
				</div>
			</div>
			<div class="form-row mb-1">
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">城市</div>
						</div>
						<input type="text" name="city" value="{$city}" class="form-control" />
					</div>
				</div>
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">省份</div>
						</div>
						<input type="text" name="province" value="{$province}" class="form-control" />
					</div>
				</div>
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">国家</div>
						</div>
						<input type="text" name="country" value="{$country}" class="form-control" />
					</div>
				</div>
			</div>
			<div class="form-row mb-1">
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">openid</div>
						</div>
						<input type="text" name="openid" value="{$openid}" class="form-control" />
					</div>
				</div>
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">unionid</div>
						</div>
						<input type="text" name="unionid" value="{$unionid}" class="form-control" />
					</div>
				</div>
			</div>
			<div class="form-row mb-1">
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">姓名</div>
						</div>
						<input type="text" name="realname" value="{$realname}" class="form-control" />
					</div>
				</div>
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">手机</div>
						</div>
						<input type="text" name="mobile" value="{$mobile}" class="form-control" />
					</div>
				</div>
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">用户组别</div>
						</div>
						<select name="groupid" class="form-control">
							<option value="0">全部</option>
							{volist name="userGroupList" id="vo"}
								<?php
									$selected = $groupid == $vo['id'] ? 'selected' : '';
								?>
								<option value="{$vo['id']}" {$selected}>{$vo['name']}</option>
							{/volist}
						</select>
					</div>
				</div>
			</div>
			<div class="form-row mb-1">
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">店铺id</div>
						</div>
						<input type="text" name="shid" value="{$shid}" class="form-control" />
					</div>
				</div>
				<div class="col-md-3">
					<div class="input-group">
						<div class="input-group-prepend">
							<div class="input-group-text">店铺名称</div>
						</div>
						<input type="text" name="shop_name" value="{$shop_name}" class="form-control" />
					</div>
				</div>
			</div>
			<div class="form-row mb-1">
				<div class="col-md-6">
					<?php
						${'sort_'.$sort} = 'checked';
					?>
					<label>排序：</label>
					<label><input type="radio" name="sort" value="create_time" {$sort_create_time} /> 注册时间</label>
					<label><input type="radio" name="sort" value="login_time" {$sort_login_time} /> 登陆时间</label>
				</div>
			</div>
			<div>
				<button type="submit" data-action="{:url('mobmall_manage/user/index')}" class="btn btn-success btn-sm J_excel">搜索</button>
				<button type="submit" data-action="{:url('mobmall_manage/user/doExcel')}" class="btn btn-danger btn-sm J_excel">导出</button>
			</div>
		</form>
	</div>
</div>
<!-- 搜索框 -->

<div class="card border-left-primary shadow mb-3">
	<div class="card-body">
	</div>
</div>

<div class="card mb-3">
	<div class="card-body">
		<div class="dataTable-toolbar">
			<a href="{:url('mobmall_manage/user/add')}" class="btn btn-primary btn-sm dataTable-add">添加</a>
		</div>
		<form action="" method="post" class="J_check_wrap J_ajaxForm">
			<table class="table table-striped table-bordered table-hover dataTable-table">
				<thead>
					<tr>
						<th width="50"><input type="checkbox" class="J_check_all" data-direction="y" data-checklist="J_check_y"></th>
						<th width="240">用户信息</th>
						<th width="150">组别余额</th>
						<th width="150">管理店铺</th>
						<td width="100">优惠券</td>
						<th width="80">状态</th>
						<th width="140">操作</th>
					</tr>
				</thead>
				<tbody>
					{volist name="list" id="vo"}
					<tr>
						<td><input type="checkbox" name="ids[]" value="{$vo['id']}" class="J_check" data-yid="J_check_y" /></td>
						<td>
							<div class="profile-box border-dotted-secondary">
								<div class="media-box media-box-appmsg media-user-box">
									<div class="media-box-hd">
										<img class="media-box-thumb" src="{$vo['avatar']}" onerror="Javascript:this.src='/static/danceAdmin/images/nopic.png';" />
									</div>
									<div class="media-box-bd">
										<div class="infobox-username">{$vo['username']}(uid:{$vo['id']})</div>
										<div class="text-gray-600">{$vo['country']} {$vo['province']} {$vo['city']}</div>
										<div class="text-gray-600">性别：{$vo['gender_show']}</div>
									</div>
								</div>
								<div class="profile-box-bd">
									<div class="text-gray-600">H5 openid</div>
									<div class="text-gray-600">{$vo['openid']}</div>
									<div class="text-gray-600">微信小程序 openid</div>
									<div class="text-gray-600">{$vo['openidmpweixin']}</div>
									<div class="text-gray-600">unionid</div>
									<div class="text-gray-600">{$vo['unionid']}</div>
								</div>
								<div class="profile-box-bd">
									<div class="text-olive">姓名：{$vo['realname']}</div>
									<div class="text-olive">手机号：{$vo['mobile']}</div>
								</div>
								<div class="profile-box-bd">
									<div class="text-olive">{$vo['longitude']}、{$vo['latitude']}</div>
								</div>
							</div>
						</td>
						<td>
							<div>
								{$userGroupList[$vo['realgroup']]['name']}
							</div>
							<div class="mt-1">
								<a href="{:url('mobmall_manage/user/setGroup', ['id'=>$vo['id']])}" class="btn btn-info btn-xs">设置组别</a>
							</div>
						</td>
						<td>
							<div>
								店铺：{$vo['shop_name']}
							</div>
							<div>
								角色组：{$merchantRoleList[$vo['realrole']]['name']}
							</div>
							<div class="mt-1">
								<a href="{:url('mobmall_manage/user/setShop', ['id'=>$vo['id']])}" class="btn btn-info btn-xs">设置店铺</a>
							</div>
							<div class="mt-1">
								<a href="{:url('mobmall_manage/user/doCancelShop', ['id'=>$vo['id']])}" class="btn btn-danger btn-xs J_layerConfirm" data-tip="确认取消吗">取消店铺</a>
							</div>
							<hr>
							{if condition="$vo['admin_uid']"}
							<div>
								用户名：{$vo['admin_username']}
							</div>
							<div class="mt-1">
								<a href="{:url('mobmall_manage/user/doCancelAdmin', ['id'=>$vo['id']])}" class="btn btn-danger btn-xs J_layerConfirm" data-tip="确认取消吗">取消管理员</a>
							</div>
							{else /}
							<div class="mt-1">
								<a href="{:url('mobmall_manage/user/setAdmin', ['id'=>$vo['id']])}" class="btn btn-info btn-xs">设置管理员</a>
							</div>
							{/if}
						</td>
						<td>
							<div>
								<a href="{:url('mobmall_manage/couponCode/index', ['uid'=>$vo['id']])}" class="btn btn-primary btn-xs">用户提货券</a>
							</div>
							<div class="mt-1">
								<a href="{:url('mobmall_manage/coupon/send', ['uid'=>$vo['id']])}" class="btn btn-success btn-xs">发放提货券</a>
							</div>
						</td>
						<td>
							<div class="dropdown">
								<button class="btn btn-info btn-xs dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
								{$vo['state_show']|raw}
								</button>
								<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
									<a class="dropdown-item J_ajaxSend" href="{:url('mobmall_manage/user/setStatus', ['id'=>$vo['id'], 'flag'=>1])}">正常</a>
									<a class="dropdown-item J_ajaxSend" href="{:url('mobmall_manage/user/setStatus', ['id'=>$vo['id'], 'flag'=>2])}">待审核</a>
									<a class="dropdown-item J_ajaxSend" href="{:url('mobmall_manage/user/setStatus', ['id'=>$vo['id'], 'flag'=>3])}">禁止</a>
								</div>
							</div>
							<div>注册时间：{$vo['create_time_show']}</div>
							<div>登录时间：{$vo['last_login_time_show']}</div>
							<div>{$vo['remark']}</div>
						</td>
						<td>
							<div>
								<a href="{:url('mobmall_manage/user/add', ['id'=>$vo['id']])}" class="btn btn-primary btn-xs dataTable-add">编辑</a>
								<a href="{:url('mobmall_manage/user/doDelete', ['id'=>$vo['id']])}" class="btn btn-danger btn-xs dataTable-delete J_layerConfirm" data-tip="您确定要执行删除操作吗？">删除</a>
							</div>
							<div class="mt-1">
								<a href="{:url('mobmall_manage/consignee/index', ['uid'=>$vo['id']])}" class="btn btn-success btn-xs">查看收货地址</a>
							</div>
							<div class="mt-1">
								<a href="{:url('mobmall_manage/user/setGold', ['id'=>$vo['id']])}" class="btn btn-warning btn-xs J_layerPcDialog" data-tip="修改金币">修改金币</a>
								<a href="{:url('mobmall_manage/goldRecord/index', ['uid'=>$vo['id']])}" class="btn btn-info btn-xs">金币流水</a>
							</div>
							<div class="mt-1">
								<a href="{:url('mobmall_manage/user/setBalance', ['id'=>$vo['id']])}" class="btn btn-warning btn-xs J_layerPcDialog" data-tip="修改余额">修改余额</a>
								<a href="{:url('mobmall_manage/balanceRecord/index', ['uid'=>$vo['id']])}" class="btn btn-info btn-xs">余额流水</a>
							</div>
							<div class="mt-1">
								<a href="{:url('mobmall_manage/user/setCommission', ['id'=>$vo['id']])}" class="btn btn-warning btn-xs J_layerPcDialog" data-tip="修改佣金">修改佣金</a>
								<a href="{:url('mobmall_manage/commissionRecord/index', ['uid'=>$vo['id']])}" class="btn btn-info btn-xs">佣金流水</a>
							</div>
						</td>
					</tr>
					{/volist}
				</tbody>
			</table>
			<div class="dataTable-controll">
				<button type="submit" class="btn btn-success btn-sm J_layerConfirmSubmit" data-action="{:url('mobmall_manage/product/setStatus', ['flag'=>'1'])}" data-tip="确认设置正常吗？">正常</button>
				<button type="submit" class="btn btn-info btn-sm J_layerConfirmSubmit" data-action="{:url('mobmall_manage/product/setStatus', ['flag'=>'2'])}" data-tip="确认设置待审核吗？">待审核</button>
				<button type="submit" class="btn btn-danger btn-sm J_layerConfirmSubmit" data-action="{:url('mobmall_manage/product/setStatus', ['flag'=>'3'])}" data-tip="确认设置禁止吗？">禁止</button>
			</div>
		</form>
		<div class="dataTable-pages">{$pageShow|raw}</div>
	</div>
</div>
{/block}


{block name="script"}
<!-- 时间选择器 -->
{include file="./themes/public/script_datetimepicker.html" /}
{/block}